Skip to content

Instantly share code, notes, and snippets.

View thapakazi's full-sized avatar
💭
🐧 🗡️ 💻

Milan Thapa thapakazi

💭
🐧 🗡️ 💻
View GitHub Profile
@subfuzion
subfuzion / curl.md
Last active May 16, 2024 18:04
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@pavlov99
pavlov99 / bash-random-lines-test.sh
Created February 20, 2016 13:43
sample random lines from file in bash, benchmark
#!/bin/bash
FILENAME="/tmp/random-lines.$$.tmp"
NUMLINES=10000000
seq -f 'line %.0f' $NUMLINES > $FILENAME;
echo "10 random lines with nl:"
$(which time) -v nl -ba $filename | sort -r | sed 's/.*[0-9]\t//' | head > /dev/null
echo "10 random lines with shuf:"
$(which time) -v shuf $FILENAME -n10 | head > /dev/null
@Olical
Olical / 20-synaptics.conf
Last active November 1, 2018 07:01
Some configuration for Arch Linux on a Dell XPS 13 9350
Section "InputClass"
Identifier "touchpad"
Driver "synaptics"
MatchIsTouchpad "on"
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "VertEdgeScroll" "on"
Option "VertTwoFingerScroll" "on"
Option "HorizEdgeScroll" "on"
@tridevgurung
tridevgurung / ImageInputCount.bat
Created July 29, 2015 11:00
Batch file to count the number of files and making a text file upon it.
echo OFF
:: Delayed Expansion causing variables to exanded at execution time rather than at parse time
setlocal enabledelayedexpansion
dir /ad /b > tel2.txt
::Entering in Day Folder
for /F "tokens=*" %%j in (tel2.txt) do (
cd "%%j"
echo "%%j"
dir /ad /b > tel1.txt
::Entering in Event Folder
.
├── books
│   ├── handlers.go
│   └── models.go
├── config
│   └── db.go
└── main.go
@manuelmeurer
manuelmeurer / swap.yml
Created June 30, 2015 09:29
Ansible role for creating a Swap file
- name: set swap_file variable
set_fact:
swap_file: /mnt/{{ swap_space }}.swap
- name: check if swap file exists
stat:
path: "{{ swap_file }}"
register: swap_file_check
- name: create swap file
@tvlooy
tvlooy / unit.sh
Last active February 4, 2024 04:20
Bash test: get the directory of a script
#!/bin/bash
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
else
@gordjw
gordjw / wordpress
Created June 4, 2015 12:21
Nginx config file to serve wordpress core and wp-content from different directories
server {
listen 443 ssl;
listen 80;
root /data/www/web/core;
server_name web;
server_name_in_redirect off;
client_max_body_size 100m;
index index.php index.html index.htm;
@kamermans
kamermans / configure_docker0.sh
Last active April 26, 2024 00:58
Change the IP subnet of Docker's docker0 interface
#!/bin/sh -e
#
# NOTE: Since Docker 1.10 (February 4, 2016), it has been possible to configure the
# Docker daemon using a JSON config file. On Linux, this file is normally located at
# /etc/docker/daemon.json. You should use this JSON config method if you are running
# a version of Docker that is at least 1.10!
# Here is an example configuration that sets the docker0 bridge IP to 192.168.254.1/24:
# {
# "bip": "192.168.254.1/24"
# }
@ostinelli
ostinelli / ecdsa_example.rb
Last active April 14, 2024 17:32
ECDSA usage from Ruby.
require 'openssl'
require 'base64'
# ===== \/ sign =====
# generate keys
key = OpenSSL::PKey::EC.new("secp256k1")
key.generate_key
public_key = key.public_key
public_key_hex = public_key.to_bn.to_s(16).downcase # public key in hex format