Skip to content

Instantly share code, notes, and snippets.

View mayorova's full-sized avatar

Daria Mayorova mayorova

  • Red Hat
  • Barcelona
View GitHub Profile
@yob
yob / README.md
Last active May 21, 2024 10:37
Installing ruby 3.0 with rbenv/ruby-build with openssl 3

Bllergh. This is a real pain.

The openssl extension that ships with ruby 3.0 only compiles against openssl <= 1.1, but now openssl 3.0 is shipped in debian testing/unstable.

Ruby bug here: https://bugs.ruby-lang.org/issues/18658

Version >= 3.0 of the openssl rubygem does compile against openssl 3.0 though.

I use rbenv to manage ruby versions on my system, which uses ruby-build to manage installs.

@vdel26
vdel26 / nginx.conf
Last active February 20, 2016 00:18
Bypass 3scale in case it is unreachable
http {
# add this near the top of the HTTP section
lua_shared_dict healthcheck 1m;
lua_socket_log_errors off;
# healthchecks are HTTP only
upstream threescale_healthcheck {
server su1.3scale.net:80;
}
var threescale = require('3scale');
var Client = threescale.Client;
client = new Client("YOUR_PROVIDER_KEY");
var authenticate = function(user_key,callback){
client.authrep_with_user_key({"user_key": user_key, "usage": { "hits": 1 } }, function(resp){
if(resp.is_success()){
callback(null,resp.is_success());
}else{
callback("403, unauthorized");
require 'csv'
require 'twitter'
def twitter_client
@twitter_client ||= Twitter::REST::Client.new do |config|
config.consumer_key = 'XXXXXX'
config.consumer_secret = 'XXXXXX'
config.access_token = 'XXXXXX'
config.access_token_secret = 'XXXXXX'
end
@vdel26
vdel26 / nginx
Last active March 16, 2023 20:31
Openresty init.d script
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Nginx init.d script, put in /etc/init.d, chmod +x /etc/init.d/nginx
# For Debian, run: update-rc.d -f nginx defaults
# For CentOS, run: chkconfig --add nginx
#
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
@yanofsky
yanofsky / LICENSE
Last active June 5, 2024 21:51
A script to download all of a user's tweets into a csv
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@bensie
bensie / base.rb
Created December 6, 2012 17:53
Sinatra API Helpers
require "sinatra/base"
require "sinatra/namespace"
require "multi_json"
require "api/authentication"
require "api/error_handling"
require "api/pagination"
module Api
class Base < ::Sinatra::Base
@mislav
mislav / easy_way.rb
Last active May 20, 2020 13:48
RESOLVE SHORT URLS before storing. Short URLs are for microblogging; you should never actually keep them around.
require 'net/http'
# WARNING do not use this; it works but is very limited
def resolve url
res = Net::HTTP.get_response URI(url)
if res.code == '301' then res['location']
else url.to_s
end
end
public class MqlKey {
public static CharSequence unescape(final CharSequence input) {
final StringBuilder output = new StringBuilder();
for (int index = 0; index < input.length(); ++index) {
final char current = input.charAt(index);
if ('$' != current) {
output.append(current);
continue;
}
@EspadaV8
EspadaV8 / gist:1357237
Created November 11, 2011 05:04
Script to import Geonames into PostgreSQL taken from http://forum.geonames.org/gforum/posts/list/15/926.page
#!/bin/bash
#===============================================================================
#
# FILE: getgeo.sh
#
# USAGE: ./getgeo.sh
#
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your
# database
#