Skip to content

Instantly share code, notes, and snippets.

View gingerhot's full-sized avatar
🎯
Focusing

B1nj0y gingerhot

🎯
Focusing
View GitHub Profile
@gingerhot
gingerhot / tantan.py
Created November 17, 2022 12:32 — forked from wong2/tantan.py
自动like探探上的所有人
#-*-coding:utf-8-*-
import hashlib
import hmac
import time
import requests
HMAC_KEY = '5tT!TQkf5fYbabw5?KL2659XgL^JgxWw8r9Y+bAvGwP-QfteQL'
class TanTan(object):
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@gingerhot
gingerhot / get_latest_release.sh
Created September 10, 2020 07:45 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@gingerhot
gingerhot / curl.md
Created August 7, 2019 07:43 — forked from subfuzion/curl.md
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.

@gingerhot
gingerhot / git-tag-delete-local-and-remote.sh
Created August 3, 2019 01:21 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@gingerhot
gingerhot / sonarqube-postgres-docker.md
Created August 2, 2019 11:11 — forked from ceduliocezar/sonarqube-postgres-docker.md
How easily run Sonar Qube and PostgresSQL with Docker Containers

TL;DR

After installing Docker, follow three steps:
Step 1:
Run: docker network create mynet

Step 2:
Run: docker run --name sonar-postgres -e POSTGRES_USER=sonar -e POSTGRES_PASSWORD=sonar -d -p 5432:5432 --net mynet postgres

Step 3:
Run: docker run --name sonarqube -p 9000:9000 -e SONARQUBE_JDBC_USERNAME=sonar -e SONARQUBE_JDBC_PASSWORD=sonar -e SONARQUBE_JDBC_URL=jdbc:postgresql://sonar-postgres:5432/sonar -d --net mynet sonarqube:5.6

@gingerhot
gingerhot / gitflowrebasing.md
Created July 19, 2019 14:47 — forked from markreid/gitflowrebasing.md
git flow with rebasing

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@gingerhot
gingerhot / .travis.yml
Created June 10, 2019 03:33 — forked from willprice/.travis.yml
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@gingerhot
gingerhot / fusion.thor
Created July 5, 2018 01:12 — forked from onemanstartup/fusion.thor
templating in thor
# Default Middleman template
class Fusion < Thor::Group
include Thor::Actions
argument :location, :type => :string
class_option "css_dir",
:default => "css",
:desc => 'The path to the css files'
class_option "js_dir",