Skip to content

Instantly share code, notes, and snippets.

View fagci's full-sized avatar
👁️
What's happening?

Mikhail fagci

👁️
What's happening?
View GitHub Profile
@andrewwatts
andrewwatts / request_time.py
Created March 10, 2012 19:33
urllib2 vs urllib3 vs requests
#!/usr/bin/env python2.7
import time
_URL = 'http://localhost/tmp/derp.html'
_NUMBER = 1000
def test_urllib2():
import urllib2
@ChengLong
ChengLong / ruby_cron.md
Created April 17, 2014 06:34
Run Ruby Script using cron job

If you see this error when cron job runs a ruby script:

'require': cannot load such file ...

And you are using bundler e.g. require 'bundler/setup'. It's probably because the directory where cron runs the script is not correct, resulting in bundler fails to load gems.

Simply changed the directory to fix it, i.e.

* * * * * /usr/local/bin/ruby -C /home/example/scripts example_script.rb >>/home/example/log/cron.log 2>&1

@Sinkler
Sinkler / gist:bfc2099235ac96937f34
Created October 13, 2014 21:27
Flask-OAuthlib sample config: twitter, facebook, instagram, vk
# Twitter
from app.config import TWITTER_APP_KEY, TWITTER_APP_SECRET
twitter_oauth = oauth.remote_app(
'twitter',
consumer_key=TWITTER_APP_KEY,
consumer_secret=TWITTER_APP_SECRET,
base_url='https://api.twitter.com/1.1/',
request_token_url='https://api.twitter.com/oauth/request_token',
@tamouse
tamouse / input.md-text
Last active May 25, 2023 13:46
Adding a class to a table in markdown (using kramdown processor as default in Jekyll).
# Let's try out a table with kramdown class tag
| A simple | table |
| with multiple | lines|
{: .my-class }
@milanaryal
milanaryal / schema-org-structured-data-markup-using-microdata.html
Last active November 4, 2023 13:45
An example of how to mark up a HTML5 webpage using the schema.org schemas and microdata.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Site Title</title>
<link rel="stylesheet" href="/assets/css/style.min.css">
@githubutilities
githubutilities / PollingSocketServer.py
Last active August 17, 2021 05:47
Socket Programming in Python
__author__ = 'will'
__version__ = "0.1"
__all__ = ["start_socket_server"]
import select
import socket
def start_socket_server():
CONNECTION_LIST = []
BUFFER_SIZE = 1024
#!/bin/bash
# Перекодирует рекурсивно в текущем каталоге имена
# файлов и каталогов в транслит.
#
# Источник: http://www.ubuntu.sumy.ua/2011/03/translit.html
shopt -s nullglob
for NAME in * ; do
TRS=`echo $NAME | sed "y/абвгдезийклмнопрстуфхцы/abvgdezijklmnoprstufxcy/"`
TRS=`echo $TRS | sed "y/АБВГДЕЗИЙКЛМНОПРСТУФХЦЫ/ABVGDEZIJKLMNOPRSTUFXCY/"`
@CMCDragonkai
CMCDragonkai / job_control_zsh_bash.md
Last active June 8, 2024 19:47
CLI: Job Control in ZSH and Bash

Job Control in ZSH and Bash

All processes in ZSH/Bash under job control are in 3 states: foregrounded, backgrounded and suspended.

# run command in the foreground
command
# run commend in the background
@raziele
raziele / gist:984cf0f112e3bbc42f184cd0597b330f
Last active March 12, 2023 18:35
A command-line piping of rtl_power. Scans frequency band for signals stronger than a threshold (-28dBFS in the example) and prints out the frequency
rtl_power -f 130M:170M:2.8M -g 30 -i 1 | awk -F ',' '{if ($7 > -28) print 1e-6*($3 + ($4 - $3) / 2)}'
@jeremyjaymes
jeremyjaymes / hugo_seo.html
Last active March 21, 2021 08:39
Hugo SEO Markup
<meta name="description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description }}{{ end }}"/>
<meta name="robots" content="noodp"/>
<link rel="canonical" href="{{ .Permalink }}" />
<!-- Twitter Card -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{ else }}{{ .Description }}{{ end }}" />
<meta name="twitter:title" content="{{ .Title }}{{ if .IsHome }} - {{ .Site.Params.Tagline }}{{ else }} - {{ .Site.Title }}{{ end }}" />
<meta name="twitter:site" content="{{ .Site.Params.twitter }}" />
<meta name="twitter:creator" content="{{ .Site.Params.twitter }}" />