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 axios, { AxiosInstance, ResponseType, Method, AxiosResponse, AxiosRequestConfig } from 'axios'; | |
import { storeData, getData } from '../helpers'; | |
export const STORAGE_TOKEN_KEY_NAME = 'token'; | |
const PROTOCOL = 'https://'; // protocols: 'http', 'https' | |
const BASE_URL = 'example.com/'; // include just domain or sub domain and domain name. | |
const LEVEL_ONE_ENDPOINT = 'api/v1/'; // first level uri. include versioning etc. | |
const TOKEN_PRIFIX = 'token '; // do not remove the space. samples: token, Bearer, etc. |
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
/** | |
createArraySubsets generate array subsets. | |
@param {Array} array - source array. | |
@param {number} subsets - number of subsets. default is 2 | |
@returns array with number of given subsets. | |
@example | |
createArraySubsets([1,2,3,4,5,6,7,8], 2); // output: [[1,2],[3,4],[5,6],[7,8]] | |
createArraySubsets([1,2,3,4], 3); // output: [[1,2,3], [4]] | |
createArraySubsets([1,2,3,4,5,6,7,8], 4); // output: [[1,2,3,4], [5,6,7,8]] | |
*/ |
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 1 * * * /backups/backup.sh >/dev/null 2>&1 |
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
package mycrypto | |
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"encoding/base64" | |
"io" | |
"time" | |
) |
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
#!/bin/sh -e | |
# Take a screenshot | |
#scrot /tmp/screen_locked.png | |
# Pixellate it 10x | |
#mogrify -scale 10% -scale 1000% /tmp/screen_locked.png | |
# Lock screen displaying this image. | |
i3lock -i /usr/share/backgrounds/warty-final-ubuntu.png |
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
version: '3' | |
services: | |
redis: | |
image: redis:5.0.0 | |
container_name: master | |
ports: | |
- "6379:6379" | |
networks: | |
- redis-replication |
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
#!/bin/sh | |
browser=${BROWSER:-google-chrome-stable} | |
pgrep -x dmenu && exit | |
choice=$(echo "" | dmenu -i -p "Search Google:") || exit 1 | |
if [ "$choice" = "" ]; then | |
$browser "https://google.com" | |
else |
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
# add this three line to i3 config file | |
bindsym XF86AudioRaiseVolume exec --no-startup-id ~/.i3/sound_script.sh incr #increase sound volume | |
bindsym XF86AudioLowerVolume exec --no-startup-id ~/.i3/sound_script.sh decr #decrease sound volume | |
bindsym XF86AudioMute exec --no-startup-id ~/.i3/sound_script.sh # mute sound |
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 axios from "axios"; | |
const singleton = Symbol(); | |
const singletonEnforcer = Symbol(); | |
function readCookie(name) { | |
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); | |
return (match ? decodeURIComponent(match[3]) : null); | |
} |
NewerOlder