Skip to content

Instantly share code, notes, and snippets.

View recall704's full-sized avatar
💭
I may be slow to respond.

recall704 recall704

💭
I may be slow to respond.
View GitHub Profile
@meanevo
meanevo / ipset.service
Last active November 20, 2023 07:21
IPSet settings persistence
#
# reference: http://namsep.blogspot.com/2015/12/yad-centos-7-iptables-ipset-and-fail2ban.html
# reference: http://pkgs.fedoraproject.org/cgit/ipset.git/tree/ipset.service
# file location: /etc/systemd/system/ipset.service
#
# systemctl enable ipset.service
# mkdir /etc/ipset
# touch /etc/ipset/ipset
# ...do something with ipset...
# ipset save > /etc/ipset/ipset
@sebble
sebble / stars.sh
Last active February 17, 2024 16:49
List all starred repositories of a GitHub user.
#!/bin/bash
USER=${1:-sebble}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$((658/100+1))
echo You have $STARS starred repositories.
echo
@alex-ant
alex-ant / gzip.go
Created January 16, 2017 13:50
golang: gzip and gunzip
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"log"
)
@saurabhshri
saurabhshri / pip.md
Last active September 24, 2023 11:07
Install and use pip in a local directory without root/sudo access.

Install and use pip in a local directory without root/sudo access.

Why?

Many users when are given server access, do not have root (or sudo) privileges and can not simply do sudo apt-get install python-pip . Here's an easy way you can install and use pip without root (or sudo) access in a local directory. Note : This works without easy_install too.

How?

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@dbathgate
dbathgate / vpc-ip-address-to-container-amazon.sh
Last active July 7, 2022 14:13
Assign VPC addresses to Docker containers associated as secondary IP addresses to an ENI in AWS
# Description: How to assign VPC addresses to Docker containers associated as secondary IP addresses to an ENI in AWS
# Operating System: Amazon Linux AMI 2016.09.1 (HVM)
# Prerequisites:
# - Assign N number of secondary IP addresses to network interface on Docker host
# - Each new container requires additional assignment of secondary IP addresses
# - Containers can be launched with --net=none to avoid adding a Docker networked NIC (docker run --net=none -d imageId)
# Credit to https://github.com/jpetazzo/pipework for steps on linking IP address
################# Setup Bridge of eth0 ######################
yum install bridge-utils -y

Run Jupyterlab on docker

Build starting from a Jupyter 2.x image.

Build

docker build -t jupyterlab .
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active April 18, 2024 18:06 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@corburn
corburn / CSP.md
Last active September 20, 2023 12:55 — forked from xrstf/letsencrypt.md
Nginx server notes

The following is from scotthelme.co.uk

Content Security Policy

with Content Security Policy (CSP) enabled(and a browser that supports it(http://caniuse.com/#feat=contentsecuritypolicy), you can tell the browser that it can only download content from the domains you explicitly allow http://www.html5rocks.com/en/tutorials/security/content-security-policy/ https://www.owasp.org/index.php/Content_Security_Policy I need to change our application code so we can increase security by disabling 'unsafe-inline' 'unsafe-eval'

@gwjwin
gwjwin / gfwlist2regex.py
Last active December 15, 2022 12:27 — forked from sorz/gfwlist2regex.py
Download and convert GFWList to url regex which compatible with Squid.
#!/usr/bin/env python
#encoding: utf-8
import urllib2
import re
from base64 import b64decode
LIST_URL = 'https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt'
DECODE_FILE = 'decode.txt'
BLACK_FILE = 'gfw.url_regex.lst'