Skip to content

Instantly share code, notes, and snippets.

@bhaskarkc
bhaskarkc / noip-dyndns-update.py
Last active March 14, 2024 21:27
A python (python3) script to update no-ip (https://www.noip.com) dynamic dns ip.
#!/usr/bin/env python
import requests, socket
username = ""
password = ""
hostname = "" # your domain name hosted in no-ip.com
# Gets the current public IP of the host machine.
myip = requests.get('http://api.ipify.org').text
@r00tdaemon
r00tdaemon / Install PyQt5 on Ubuntu with python3 .md
Last active February 23, 2024 04:50
Install PyQt5 on Ubuntu with python3. Steps to set up PyQt5 (ubuntu). With python code generation

Installation

pip3 install --user pyqt5  
sudo apt-get install python3-pyqt5  
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools

Configuring to run from terminal

@seventhskye
seventhskye / delete_all_objects.py
Last active February 14, 2023 12:08
A script to delete all objects, versions and delete markers from an s3 bucket.
#!/usr/bin/env python
import boto3
client = boto3.client('s3')
Bucket = 'a-bucket'
Prefix = 'a-prefix' # leave blank to delete the entire contents
IsTruncated = True
MaxKeys = 1000
KeyMarker = None
@rgl
rgl / wait_for_http_200.sh
Last active March 7, 2024 17:08
Wait for an HTTP endpoint to return 200 OK with Bash and curl
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done'
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76
@tjamps
tjamps / README.md
Last active February 29, 2024 14:57
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@jeffdonthemic
jeffdonthemic / gist:7247654
Last active August 6, 2020 03:56
Passing parameters in an Angular.js Controller to a Resource
<script>
// in the html page
angular.module('config', []).constant('APIKEY',''5250738f97ce29c219000011'');
</script>
myApp.controller('JobsCtrl', ['$scope', 'Jobs', 'APIKEY', function($scope, Jobs, apiKey) {
var promise = Jobs(apiKey).query().$promise;
// do more awesome programming
}
@batok
batok / paramiko_example.py
Created April 10, 2012 16:11
Paramiko example using private key
import paramiko
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print "connecting"
c.connect( hostname = "www.acme.com", username = "ubuntu", pkey = k )
print "connected"
commands = [ "/home/ubuntu/firstscript.sh", "/home/ubuntu/secondscript.sh" ]
for command in commands:
print "Executing {}".format( command )