Skip to content

Instantly share code, notes, and snippets.

View Abreto's full-sized avatar
🔋
Charging

Abreto Abreto

🔋
Charging
View GitHub Profile
/**
* $ npm i jimp
*
* Copied from https://stackoverflow.com/a/48158807
*/
const fs = require('fs')
const util = require('util')
const Jimp = require('jimp')
@Abreto
Abreto / do-what-i-want.sh
Last active October 25, 2022 16:55
Server related scripts
#!/usr/bin/env sh
[ $(id -u) -eq 0 ] || sh_c=sudo
do_it() {
#if [ ! $(id -u) -eq 0 ]; then
# echo Sorry but I require root privileges.
# exit -1
#fi
@Abreto
Abreto / certbot-wildcard.sh
Last active February 16, 2020 14:57
for wildcard domains
#!/usr/bin/env sh
# certbot certonly --manual --preferred-challenges=dns-01 --server=https://acme-v02.api.letsencrypt.org/directory
set -x
new () {
docker run --rm -it \
-v "$(pwd)":/etc/letsencrypt \
certbot/certbot \
@Abreto
Abreto / Dockerfile
Last active March 25, 2019 16:49
Dockerfile entrypoint example for flexible cli arguments
ENTRYPOINT [ "/entrypoint.sh" ]
@Abreto
Abreto / play.js
Created January 25, 2019 16:36
game-cheating
// cheater for http://www.cuishuai.cc/game/
// use it in console of Chrome DevTools
function play() {
const box = document.getElementById('box')
const girds = box.children
const num = box.childElementCount
@Abreto
Abreto / checkproxy.sh
Created December 5, 2018 03:49
ssh proxy scripts
#!/usr/bin/env bash
ps aux | grep "[0-9] ssh -qTfNn -D 7070"
@Abreto
Abreto / pull-all.sh
Created July 9, 2018 11:27
pull all remote branches to local
#!/usr/bin/env bash
cd $1
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@Abreto
Abreto / .gitignore
Created June 28, 2018 11:10
`.gitignore` for vivado projects
#########################################################################################################
## This is an example .gitignore file for Vivado, please treat it as an example as
## it might not be complete. In addition, XAPP 1165 should be followed.
#########################################################################################################
#########
#Exclude all
#########
*
!*/
!.gitignore
@Abreto
Abreto / transcode.sh
Created June 23, 2018 07:43
Travel a directory recursively
#!/usr/bin/env bash
outdir=$2
function travel() {
mkdir -p $outdir/$1
for f in `ls $1`
do
if [ -d $1/$f ]; then
travel $1/$f
<!DOCTYPE html>
<html>
<head>
<title>Game</title>
<style>
body {
background-color: black;
color: green;
}
.withborder {