This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# make sure this bash script has executable permission, if doesn't have, run following command | |
# > $ chmod +x *.sh | |
gsutil - m cp - r "gs://[BUCKET_PATH]/$1". \ | |
zip - r /root/ $1.zip $1 \ | |
rm - rf $1 \ | |
gsutil cp /root/ $1.zip gs://[BUCKET_PATH]/ \ | |
rm -rf /root/$1.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@ts-nocheck | |
import { isEqual, isObject, transform } from 'lodash' | |
/** | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from tabula import read_pdf | |
# Specify file name | |
FILE_NAME = "sample.pdf" | |
# Total Pages | |
TOTAL_PAGES = 2 | |
# Read the first page. | |
final_frame = read_pdf(FILE_NAME, pages="1")[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const axios = require('axios'); | |
const Papa = require("papaparse"); | |
fs.readFile('sample.csv', 'utf8', (err, data) => { | |
if (err) { | |
return console.error(err) | |
} | |
const [headers, ...parsedCSVData] = Papa.parse(data).data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using for construct | |
# [0, 0, 0] | |
for _x <- 0..2, do: 0 | |
# [0, 2, 4, 6, 8] | |
for x <- 0..4, do: x * 2 | |
# List of 5 random numbers | |
for _x <- 0..4, do: System.unique_integer([:positive]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [0, 0, 0] | |
Array(3).fill(0); | |
Array.from(Array(3), () => 0); | |
// [0, 2, 4, 6, 8] | |
Array.from(Array(5), (_, index) => index * 2); | |
// Array of 5 random numbers | |
Array.from(Array(5), Math.random()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def browser_open(url) do | |
win_cmd_args = ["/c", "start", String.replace(url, "&", "^&")] | |
cmd_args = | |
case :os.type() do | |
{:win32, _} -> | |
{"cmd", win_cmd_args} | |
{:unix, :darwin} -> | |
{"open", [url]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ENCRYPTION_KEY = "put something secret here"; | |
$ENCRYPTION_ALGORITHM = 'AES-256-CBC'; | |
function encrypt($plain_text) { | |
global $ENCRYPTION_KEY; | |
global $ENCRYPTION_ALGORITHM; | |
$EncryptionKey = make_hash($ENCRYPTION_KEY, 32); | |
// create random Initialization Vector |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Cipher.AES do | |
@moduledoc """ | |
Functions related to encrypting and decrypting data using the Advanced | |
Encryption Standard (AES). | |
""" | |
@block_size 16 | |
@secret_key "put something secret here" | |
@doc """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ENCRYPTION_KEY = ''; | |
$ENCRYPTION_ALGORITHM = 'AES-128-ECB'; | |
function encrypt($plainText) { | |
global $ENCRYPTION_KEY; | |
global $ENCRYPTION_ALGORITHM; | |
$EncryptionKey = makeHash($ENCRYPTION_KEY, 16); | |
$encryptedText = openssl_encrypt($plainText, $ENCRYPTION_ALGORITHM, $EncryptionKey); |
NewerOlder