Skip to content

Instantly share code, notes, and snippets.

View chinshr's full-sized avatar

Juergen Fesslmeier chinshr

  • Palo Alto, California
View GitHub Profile
@chinshr
chinshr / snowflake-ish-postgres.sql
Last active April 5, 2023 18:47
Snowflake'ish Id generation with PostgreSQL
-- Modified from https://instagram-engineering.com/sharding-ids-at-instagram-1cf5a71e5a5c
-- And https://gist.github.com/yohang88/f950fbb239192866895a
-- And https://rextester.com/NPNU50638
CREATE OR REPLACE FUNCTION message.next_id() RETURNS TRIGGER AS $$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
now_millis bigint;
-- the id of this DB shard is either hard coded, or

Top

  1. Optiweigh : 2248
  2. Ydoc : 2114|2156|65198
  3. Yabby : 2173
  4. Digital Matter : 66204|65158
  5. CAS Tecnologia : 2194
  6. Rainforest Connection : 2172
  7. FieldPRO : 66498
@chinshr
chinshr / regions_iso3.md
Last active March 3, 2023 21:06
Regions to countries

Significant Regions

  • Africa : DZA|AGO|BEN|BWA|BFA|BDI|CPV|CMR|CAF|TCD|COM|COD|COG|CIV|DJI|EGY|GNQ|ERI|ESH|SWZ|ETH|GAB|GMB|GHA|GIN|GNB|KEN|LSO|LBR|LBY|MDG|MWI|MLI|MRT|MUS|MAR|MOZ|MYT|NAM|NER|NGA|REU|RWA|STP|SEN|SYC|SLE|SOM|ZAF|SSD|SDN|TZA|TGO|TUN|UGA|ZMB|ZWE
  • Australia : AUS
  • Brazil : BRA
  • Central America & Caribbean : ATG|BES|BHS|BRB|BLM|BLZ|CYM|CRI|CUB|DMA|DOM|SLV|GRL|GRD|GLP|GTM|HTI|HND|JAM|MAF|MTQ|MEX|SPM|MSR|ANT|CUW|ABW|SXM|NIC|PAN|PRI|KNA|LCA|SPM|VCT|TTO|TCA|VGB|VIR
  • Europe : ALA|ALB|AND|AUT|BLR|BEL|BIH|BGR|HRV|CYP|CZE|DNK|EST|FRO|FIN|FRA|DEU|GIB|GRC|GGY|HUN|ISL|IRL|IMN|ITA|JEY|KAZ|KOS|LVA|LIE|LTU|LUX|MKD|MLT|MCO|MDA|MNE|NLD|NOR|POL|PRT|ROU|SJM|SMR|SRB|SVK|SVN|ESP|SWE|CHE|UKR|GBR|VAT
  • New Zealand : NZL
  • South East Asia : BRN|KHM|IDN|JPN|LAO|MAC|MYS|MMR|PHL|SGP|THA|TLS|VNM|PRK|KOR|PNG|TWN
  • South America : ARG|BOL|BRA|CHL|COL|ECU|FLK|GUF|GUY|PRY|PER|SUR|URY|VEN
curl -v http://phls-live.cdn.turner.com/cnn/cnnintl/hls/2/stream_Layer4.m3u8?hdnea2=exp=1503540817~acl=%2f*~hmac=34d47f5cb1357873a807b6dbeae38205afea761187fc8ad999fc24a88ce3c30c
jfesslmeier ~/workspace/snappytv-app/www/talkntv (jfesslmeier/SNAP-3110) $ arc land --trace
ARGV '/opt/twitter_mde/package/arc/7cc4a72709f8f4ce718966e2542aeafa0e2e789d9860f35c1d73a8e5c8191941/arcanist/bin/../scripts/arcanist.php' 'land' '--trace'
LOAD Loaded "phutil" from "/opt/twitter_mde/package/arc/7cc4a72709f8f4ce718966e2542aeafa0e2e789d9860f35c1d73a8e5c8191941/libphutil/src".
LOAD Loaded "arcanist" from "/opt/twitter_mde/package/arc/7cc4a72709f8f4ce718966e2542aeafa0e2e789d9860f35c1d73a8e5c8191941/arcanist/src".
Config: Reading user configuration file "/Users/jfesslmeier/.arcrc"...
Config: Reading system configuration file "/etc/arcconfig"...
Working Copy: Unable to find .arcconfig in any of these locations: /Users/jfesslmeier/workspace/snappytv-app/.arcconfig.
Working Copy: Path "/Users/jfesslmeier/workspace/snappytv-app/www/talkntv" is part of `git` working copy "/Users/jfesslmeier/workspace/snappytv-app".
Working Copy: Project root is at "/Users/jfesslmeier/workspace/snappytv-app".
Config: Did no
08:34:53 worker.1 | /home/ubuntu/.rvm/gems/ruby-2.2.3@vz-cpw/gems/diarize-ruby-0.3.3/lib/diarize/audio.rb:37: [BUG] Segmentation fault at 0x00000000000000
08:34:53 worker.1 | ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
08:34:53 worker.1 |
08:34:53 worker.1 | -- Control frame information -----------------------------------------------
08:34:53 worker.1 | c:0038 p:---- s:0159 e:000158 CFUNC :import
08:34:53 worker.1 | c:0037 p:0019 s:0155 e:000154 METHOD /home/ubuntu/.rvm/gems/ruby-2.2.3@vz-cpw/gems/diarize-ruby-0.3.3/lib/diarize/audio.rb:37
08:34:53 worker.1 | c:0036 p:0052 s:0150 e:000149 METHOD /home/ubuntu/vz-cpw/lib/cpw/speech/audio_splitter.rb:69
08:34:53 worker.1 | c:0035 p:0079 s:0145 e:000144 METHOD /home/ubuntu/vz-cpw/lib/cpw/speech/audio_splitter.rb:29
08:34:53 worker.1 | c:0034 p:0116 s:0141 e:000138 METHOD /home/ubuntu/vz-cpw/lib/cpw/speech/engines/base.rb:84
08:34:53 worker.1 | c:0033 p:0014 s:0135 e:000134 METHOD /home/ubuntu/vz-cpw/lib/cpw/speech/engines/google_cloud_speech_engin
@chinshr
chinshr / codeclimate.yml
Created November 9, 2015 19:11
Codecomplexity CC yaml
languages:
Ruby: true
exclude_paths:
- "app/models/video_migration.rb" # is what was intended to be ignored with the previous lib/*_migration.rb ?
- "app/smart/**/*.rb"
- "app/utviz/**/*.rb"
- "config/application.rb" #this didnt seem to be ignored by the following line.
- "config/**/*"
@chinshr
chinshr / codeclimate-complexity-33.rb
Created November 9, 2015 18:50
Codeclimate complexity 33
def perform
Rails.logger.info "AudioExtractor: creating Elastic Transcoder Job for #{ingest.video.handle}"
client.create_job({
pipeline_id: PIPELINE_ID,
input: {
key: "#{ingest.video.handle}.mp4"
},
output: {
key: "#{ingest.video.handle}.mp3",
@chinshr
chinshr / Jenkinsfile
Last active October 16, 2023 09:25
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@chinshr
chinshr / gist:38f525b3101af3174f71
Created March 26, 2015 21:40
FedEx Larkspur Dr., Healsburgh, CA", address validation error
POST https://gateway.fedex.com:443/xml/
> <AddressValidationRequest xmlns="http://fedex.com/ws/addressvalidation/v2">
<WebAuthenticationDetail>
<UserCredential>
<Key>wdnHHEULCYFPnEwq</Key>
<Password>KJgbpvpE6W5aroRiAXCAEJO0b</Password>
</UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
<AccountNumber>632499744</AccountNumber>