Skip to content

Instantly share code, notes, and snippets.

@jniltinho
jniltinho / install_dotnet-sdk.sh
Last active February 5, 2023 12:28
Install .NET Core 2.0.0 SDK for Ubuntu 16.04
#!/bin/bash
## Install .NET Core 2.0.0 SDK on Ubuntu 16.04 64Bits
## Author: Nilton OS www.linuxpro.com.br
## https://www.microsoft.com/net/core#linuxubuntu
## https://docs.microsoft.com/en-us/aspnet/core/publishing/apache-proxy
## https://medium.com/@renato.groffe/net-core-e-sql-server-em-linux-primeiros-passos-89a7cb475ebd
## Version 0.1
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
@zoharbabin
zoharbabin / certbotresetcert.sh
Created July 23, 2017 16:11
Delete and reinstall SSL certificates with certbot on Ubuntu
certbot certificates
# find the path to the fullchain certificate you wish to reinstall
certbot revoke --cert-path /etc/letsencrypt/live/... #path to the cert from above
certbot delete --cert-name yourdomain.com
rm -Rf /etc/apache2/sites-available/000-default-le-ssl.conf #or whatever the name of the apache conf you had it configured on
rm -Rf 000-default-le-ssl.conf #or whatever the name of the apache conf you had it configured on
sudo apache2ctl restart
certbot #follow the guide to setup the new certificate

Creating a redis Module in 15 lines of code!

A quick guide to write a very very simple "ECHO" style module to redis and load it. It's not really useful of course, but the idea is to illustrate how little boilerplate it takes.

Step 1: open your favorite editor and write/paste the following code in a file called module.c

#include "redismodule.h"
/* ECHO <string> - Echo back a string sent from the client */
int EchoCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
@ttsiodras
ttsiodras / hack.py
Last active August 21, 2017 09:48
I just did something that depending on your viewpoint on coding, is either an insult to God and humanity, or absolutely brilliant.
#
# I inherited a large code base, where hundreds of code paths end up
# calling "common_function_called_in_gazillion_places".
#
# And the need arose for this function to access the HTTP request's
# headers...
#
# What to do? Refactor all the places leading up to here? In a dynamically
# typed language, with no compiler to tell us the places to refactor?
#
@anvaka
anvaka / top-github.md
Last active February 3, 2021 19:58
Top GitHub users by total number of stars

I was playing with GitHub Archive recently. Out of curiosity I ran this query:

SELECT COUNT(repository_owner) as totalStars, repository_owner
FROM [githubarchive:github.timeline] 
WHERE type = 'WatchEvent'
GROUP BY repository_owner
ORDER BY totalStars DESC
LIMIT 1000
@mdisec
mdisec / gist:b0d44cc14e4c4c10cd64
Last active February 10, 2023 21:59
Kibana with Nginx Reverse Proxy + SSL + HTTP Auth
# Nginx proxy for Elasticsearch + Kibana
#
# In this setup, we are password protecting the saving of dashboards. You may
# wish to extend the password protection to all paths.
#
# Even though these paths are being called as the result of an ajax request, the
# browser will prompt for a username/password on the first request
#
# If you use this, you'll want to point config.js at http://FQDN:443/ instead of
# http://FQDN:9200
@cridenour
cridenour / gist:74e7635275331d5afa6b
Last active August 7, 2023 13:52
Setting up Vim as your Go IDE

Setting up Vim as your Go IDE

The final IDE

Intro

I've been wanting to do a serious project in Go. One thing holding me back has been a my working environment. As a huge PyCharm user, I was hoping the Go IDE plugin for IntelliJ IDEA would fit my needs. However, it never felt quite right. After a previous experiment a few years ago using Vim, I knew how powerful it could be if I put in the time to make it so. Luckily there are plugins for almost anything you need to do with Go or what you would expect form and IDE. While this is no where near comprehensive, it will get you writing code, building and testing with the power you would expect from Vim.

Getting Started

I'm assuming you're coming with a clean slate. For me this was OSX so I used MacVim. There is nothing in my config files that assumes this is the case.

@chadrien
chadrien / AppController.php
Last active November 26, 2021 10:49
CakePHP force trailing slash
<?php
App::uses('TrailingSlashUtil', 'Lib');
App::uses('Controller', 'Controller');
class AppCpontroller extends Controller {
public function redirect ($url, $status = null, $exit = true) {
$url = TrailingSlashRouter::url($url);
@nicolasramy
nicolasramy / momoticon.md
Last active February 10, 2017 12:10
Momoticon, another version of emoticons

Happy

^_^
^.^