Skip to content

Instantly share code, notes, and snippets.

View pbassut's full-sized avatar

Patrick Bassut pbassut

View GitHub Profile
#include <stdio.h>
#include <stdint.h>
uint32_t NumberOfSetBits(uint32_t i)
{
return (((((i - ((i >> 1) & 0x55555555)) & 0x33333333) + (((i - ((i >> 1) & 0x55555555)) >> 2) & 0x33333333) + (((i - ((i >> 1) & 0x55555555)) & 0x33333333) + (((i - ((i >> 1) & 0x55555555)) >> 2) & 0x33333333) >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
int main(){
printf("%d", NumberOfSetBits(127));
### Keybase proof
I hereby claim:
* I am pbassut on github.
* I am pbassut (https://keybase.io/pbassut) on keybase.
* I have a public key whose fingerprint is B80D EAD9 EFA7 D712 3A64 D255 4FAE A701 18DC EF18
To claim this, I am signing this object:
def strip_accents(s):
return ''.join(c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn')
def create_username(first_name, last_name=None):
guessed_name = first_name[:10]
if last_name:
guessed_name += '.%s' % last_name[:10]
import sys
import math
from collections import deque
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
table = {
'I': 1,
'V': 5,
'X': 10,
curl 'https://chat.stackoverflow.com/chats/stars/6?count=0&_=1453994620715' -H -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8,pt-BR;q=0.6,pt;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36' -H 'Accept: text/html, */*; q=0.01' -H 'Referer: https://chat.stackoverflow.com/rooms/6/python' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Cache-Control: max-age=0' --compressed
class EscapeFragmentMiddleware():
def process_view(self, request, view_func, view_args, view_kwargs):
if request.GET.get('_escaped_fragment_', None):
return reverse_proxy(request)
return view_func(request, *view_args, **view_kwargs)
{
"ip": "192.168.25.3",
"default_dns": "8.8.8.8"
}
var fs = require('fs');
var logger = require('./logger');
/*
Change setting for UDID in aTVSettings.json, this is called from the settings page.
*/
function changeSetting(UDID, setting, newSetting){
if (setting == 'tvendpoint'){
setTVEndpoint(newSetting);
return;
2015-09-26T04:33:43.000Z - notice: Started logger in Debug mode!
2015-09-26T04:33:43.025Z - notice: Starting PopcornTV
2015-09-26T04:33:43.027Z - DNS: DnsProxy binding on 192.168.25.3:53
2015-09-26T04:33:43.563Z - Web: listening on 192.168.25.3:80
2015-09-26T04:33:43.566Z - Web: SSL Web: listening on 192.168.25.3:443
2015-09-26T04:33:43.579Z - notice: Starting Commit
2015-09-26T04:33:53.664Z - Debug: Query: {}
2015-09-26T04:33:53.665Z - Web: templates/MovieNav.xml
2015-09-26T04:33:53.839Z - Debug: Query: {}
2015-09-26T04:33:53.840Z - Web: /js/utils.js
23-Sep-2015 22:08:57.449 SEVERE [http-nio-8000-exec-5] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [webservice] in context with path [/taxonomy] threw exception
org.jboss.resteasy.spi.UnhandledException: Response is committed, can't handle exception
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:148)
at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:432)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:376)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDi