Skip to content

Instantly share code, notes, and snippets.

View FanchenBao's full-sized avatar

Fanchen Bao FanchenBao

View GitHub Profile
@gitaarik
gitaarik / git_submodules.md
Last active June 8, 2024 10:16
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@treyhunner
treyhunner / time_dict_merge.py
Last active November 3, 2023 08:13
Test performance of different dictionary merging functions in Python
"""
Results:
multiple_update: 33 ms
copy_and_update: 27 ms
dict_constructor: 29 ms
kwargs_hack: 33 ms
dict_comprehension: 33 ms
concatenate_items: 81 ms
union_items: 81 ms
@rjz
rjz / ngrok_hostname.sh
Created August 9, 2016 16:20
Get ngrok hostname from command line
#!/bin/sh
# ngrok's web interface is HTML, but configuration is bootstrapped as a JSON
# string. We can hack out the forwarded hostname by extracting the next
# `*.ngrok.io` string from the JSON
#
# Brittle as all get out--YMMV. If you're still reading, usage is:
#
# $ ./ngrok_hostname.sh <proto> <addr>
#
@dropmeaword
dropmeaword / wifiscanner.py
Created June 20, 2017 22:38 — forked from D4rKP01s0n/wifiscanner.py
A simple python script which records and logs wifi probe requests.
#########################################################################
# Wifiscanner.py - A simple python script which records and logs wifi probe requests.
# Author - D4rKP01s0n
# Requirements - Scapy and Datetime
# Inspiration - Tim Tomes (LaNMaSteR53)'s WUDS https://bitbucket.org/LaNMaSteR53/wuds/
# Reminder - Change mon0 (around line 65) to your monitor-mode enabled wifi interface
#########################################################################
from datetime import datetime
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active June 5, 2024 09:59
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@beeleebow
beeleebow / group_by_intervals_postgres.sql
Last active January 16, 2023 00:28
PSQL - Group Rows with timestamp interval
-- POSTGRES SQL.
-- Count of rows where a timestamp column falls in interval.
-- This example uses a 5 minute interval ( 300 seconds = 5 minutes).
-- You need to replace the things inside square brackets, i.e. provide
-- the name of the table and timestamp column.
SELECT COUNT(*) cnt,
to_timestamp(floor((extract('epoch' from [Timestamp Column]) / 300 )) * 300)
AT TIME ZONE 'UTC' as expiry_interval
FROM [Table] GROUP BY expiry_interval
order by expiry_interval
@biggates
biggates / petstore_oas3_requestBody_example.json
Last active February 2, 2023 23:33
Example of OpenAPI Specification v3.0.0, containing multiple examples of requestBody
{
"openapi": "3.0.2",
"info": {
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"version": "1.0.0",
"title": "Swagger Petstore",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"email": "apiteam@swagger.io"
},
@srenatus
srenatus / Rego.sublime-syntax
Last active February 14, 2020 13:57
@eephillip has created a package for the sublime syntax, see https://github.com/eephillip/rego.sublime-package
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Rego
file_extensions:
- rego
- Rego
scope: source.rego
contexts:
main:
@defulmere
defulmere / settings.py
Last active June 7, 2024 08:08
How to override an old sqlite3 module with pysqlite3 in django settings.py
# ⚠️ USE AT YOUR OWN RISK
# first: pip install pysqlite3-binary
# then in settings.py:
# these three lines swap the stdlib sqlite3 lib with the pysqlite3 package
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
DATABASES = {
@davidteren
davidteren / nerd_fonts.md
Last active June 7, 2024 12:53
Install Nerd Fonts via Homebrew [updated & fixed]